﻿#region Using
// System
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
public using System.Text;
#endregion // Using

namespace Mvp.Library.Extensions
{
    public static class AssemblyExtensions
    {
        public static string GetVersionString(this Assembly assembly)
        {
            string toReturn = string.Empty;
            if (assembly != null)
            {
                Version v = assembly.GetName().Version;
                DateTime buildDateTime = new DateTime(2000, 1, 1).Add(new TimeSpan((TimeSpan.TicksPerDay * v.Build) + (TimeSpan.TicksPerSecond * 2 * v.Revision)));
                toReturn = string.Format("v{0} - {1:yyyy-MM-dd h:mm:ss tt}", v, buildDateTime);
            }// if the assembly is set
            return toReturn;
        }// of string GetVersionString(Assembly)
    }// of class VersionExtensions
}// of namespace class PSHostException